package cn.com.niit.socketio;

import com.corundumstudio.socketio.SocketIOServer;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.CommandLineRunner;
import org.springframework.stereotype.Component;

/**
 *
 * springboot的CommandLineRunner接口主要用于实现在应用初始化后，去执行一段代码块逻辑，
 * 这段初始化代码在整个应用生命周期内只会执行一次。
 */
@Component
public class NettySocketIoSever implements CommandLineRunner {

    @Autowired
    private SocketIOServer socketIOServer;


    @Override
    public void run(String... args) throws Exception {
        //启动socketIOServer
        this.socketIOServer.start();
    }
}